/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.foxline.service;

import br.com.foxline.model.Enterprise;
import br.com.foxline.model.TypeLot;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.Query;

/**
 *
 * @author roniere
 */
@Stateless
public class TypeLotService extends GenericService<TypeLot> {

    public TypeLotService() {
        super(TypeLot.class);
    }
    
    public List<TypeLot> getTypeLotForEnterprise(Enterprise enterprise){
        String sql = "Select tl from Enterprise e JOIN e.typeLots tl where "
                + " e.id = :id";
        Query query = getEntityManager().createQuery(sql);
        query.setParameter("id", enterprise.getId());
        
        return query.getResultList();
  }
}
